# routers/meetings_transcripts.py
import logging
from fastapi import APIRouter, Depends
from schema_base import PageInationResult
from http_base import unified_resp
from ..schemas.meetings_transcripts import (
    MeetingsTranscriptsListIn, MeetingsTranscriptsDetailIn, MeetingsTranscriptsAddIn, MeetingsTranscriptsEditIn, MeetingsTranscriptsDelIn, MeetingsTranscriptsOut
)
from ..service.meetings.meetings_transcripts import IMeetingsTranscriptsService

logger = logging.getLogger(__name__)
router = APIRouter(prefix="/transcripts")


@router.post("/list", response_model=PageInationResult[MeetingsTranscriptsOut], summary="转录列表")
@unified_resp
async def transcript_list(list_in: MeetingsTranscriptsListIn, svc: IMeetingsTranscriptsService = Depends()):
    return await svc.list(list_in)


@router.get("/detail", summary="转录详情")
@unified_resp
async def transcript_detail(detail_in: MeetingsTranscriptsDetailIn = Depends(), svc: IMeetingsTranscriptsService = Depends()):
    return await svc.detail(detail_in.id)


@router.post("/add", summary="新增转录（通常由后台调用）")
@unified_resp
async def transcript_add(add_in: MeetingsTranscriptsAddIn, svc: IMeetingsTranscriptsService = Depends()):
    return await svc.add(add_in)


@router.post("/edit", summary="编辑转录")
@unified_resp
async def transcript_edit(edit_in: MeetingsTranscriptsEditIn, svc: IMeetingsTranscriptsService = Depends()):
    return await svc.edit(edit_in)


@router.post("/del", summary="删除转录")
@unified_resp
async def transcript_del(del_in: MeetingsTranscriptsDelIn, svc: IMeetingsTranscriptsService = Depends()):
    return await svc.delete(del_in.id)
